package com.example.lotterysystem.service.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

/**
 * 奖品的等级
 */
@AllArgsConstructor
@Getter
public enum ActivityPrizeTiersEnum {

    FIRST_PRIZE(1,"一等奖"),

    SECOND_PRIZE(2,"二等奖"),

    THIRD_PRIZE(3,"三等奖");

    private final Integer code;

    private final String message;

    /**
     * 根据传来的 name(Sring) 返回和其相等的 ActivityPrizeTiersEnum 类型
     * @param name
     * @return
     */
    public static ActivityPrizeTiersEnum forName(String name) {
        for (ActivityPrizeTiersEnum activityPrizeTiersEnum : ActivityPrizeTiersEnum.values()) {
            if (activityPrizeTiersEnum.name().equalsIgnoreCase(name)) {
                return activityPrizeTiersEnum;
            }
        }
        return null;
    }
}
